//
//  API_GCD_Demo1VC.swift
//  APSwift
//
//  Created by jianbo.pei on 2022/5/24.
//

import UIKit

/// 这是一个结构体。
/// 它什么都没干......
/// - important: 这很重要!
/// - warning: 警告!
/// - attention: 注意!
/// - note: 另外......没什么好说的了......
/// - version: 1.0
/// - author: Zenny Chen
 struct MyStruct {

}

class API_GCD_Demo1VC: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        syncSer()
        APPrint()
        asyncSer()
        
    }

}

//!!!: 同步串行
extension API_GCD_Demo1VC {
    func syncSer() {
        let queue = DispatchQueue(label: "apswift.syncSer")
        queue.sync {
            for i in 0..<50 {
                print("同步串行 i is \(i)")
            }
        }
    }
}

//!!!: 异步串行
extension API_GCD_Demo1VC {
    func asyncSer() {
        let queue = DispatchQueue(label: "apswift.asyncSer")
        queue.async {
            for i in 0..<50 {
                print("异步串行 i is \(i)")
            }
        }
    }
}
